#include "shaderBuilder.h"

shaderBuilder::shaderBuilder() {
    this->vertexShader = "";
    this->fragmentShader = "";
    program = -1;
}

shaderBuilder::shaderBuilder(const shaderBuilder &sb){
    this->vertexShader = sb.getVertexShader();
    this->fragmentShader = sb.getFragmentShader();
    this->program = sb.getProgram();
}

const std::string shaderBuilder::getVertexShader()const{
    return this->vertexShader;
}

const std::string shaderBuilder::getFragmentShader()const{
    return this->fragmentShader;
}

const unsigned int &shaderBuilder::getProgram()const{
    return this->program;
}

void shaderBuilder::use(){
    glUseProgram(this->program);
}

void shaderBuilder::setInt(const std::string &name, int value) const
{ 
    glUniform1i(glGetUniformLocation(this->program, name.c_str()), value); 
}

void shaderBuilder::setMat4(const std::string &matName, glm::mat4 mat){
    glUniformMatrix4fv(glGetUniformLocation(this->getProgram(), matName.c_str()), 1, GL_FALSE, &mat[0][0]);
}
